﻿/**
 * Created by 123 on 2020/12/14.
 * */

#ifndef MIDDLEWARE_AUTODETECTWRITER_H
#define MIDDLEWARE_AUTODETECTWRITER_H

#include "DeviceWriter.h"
#include "AutoDetectReader.h"

class ConnectionInfo;

class AutoDetectWriter : public DeviceWriter {
public:
    ~AutoDetectWriter();

    AutoDetectWriter(AutoDetectType detectType, std::string targetUUID);

    int64_t onWrite(char *buffer, int64_t len) override;

    int buildConnectionInfo(void *params);

    int changeConnection(void *params);

    AutoDetectType detectType;
    std::string targetUUID;
    int connectState = 0;   /** 0 not connected, 1 isConnecting, 2, connected. */
    ConnectionInfo *info = nullptr;
};


#endif /** MIDDLEWARE_AUTODETECTWRITER_H */
